.class Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView$1;
.super Lcom/burstly/lib/component/networkcomponent/burstly/wrapper/WebViewClientWrapper;
.source "RewardsView.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->setWebViewClient(Landroid/webkit/WebViewClient;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;


# direct methods
.method constructor <init>(Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;Landroid/webkit/WebViewClient;)V
    .locals 0
    .parameter
    .parameter "x0"

    .prologue
    .line 248
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView$1;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;

    invoke-direct {p0, p2}, Lcom/burstly/lib/component/networkcomponent/burstly/wrapper/WebViewClientWrapper;-><init>(Landroid/webkit/WebViewClient;)V

    return-void
.end method


# virtual methods
.method public onLoadResource(Landroid/webkit/WebView;Ljava/lang/String;)V
    .locals 5
    .parameter "view"
    .parameter "url"

    .prologue
    .line 279
    sget-object v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v1, "RewardsView"

    const-string v2, "Loading {0}"

    const/4 v3, 0x1

    new-array v3, v3, [Ljava/lang/Object;

    const/4 v4, 0x0

    aput-object p2, v3, v4

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 280
    invoke-super {p0, p1, p2}, Lcom/burstly/lib/component/networkcomponent/burstly/wrapper/WebViewClientWrapper;->onLoadResource(Landroid/webkit/WebView;Ljava/lang/String;)V

    .line 281
    return-void
.end method

.method public onPageFinished(Landroid/webkit/WebView;Ljava/lang/String;)V
    .locals 3
    .parameter "view"
    .parameter "url"

    .prologue
    const/4 v2, 0x0

    .line 285
    invoke-super {p0, p1, p2}, Lcom/burstly/lib/component/networkcomponent/burstly/wrapper/WebViewClientWrapper;->onPageFinished(Landroid/webkit/WebView;Ljava/lang/String;)V

    .line 287
    const-string v0, "javascript:function burstly_videoPlay() {alert(\"pVideo=\"+ findVideoSrc()); return false; }"

    invoke-virtual {p1, v0}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 291
    const-string v0, "javascript:function burstly_dispatchPlay() { var burstly_evt = document.createEvent(\'Event\'); burstly_evt.initEvent(\'play\', true, true); return document.getElementById(burstly_videoElement).dispatchEvent(burstly_evt); }"

    invoke-virtual {p1, v0}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 292
    const-string v0, "javascript:function burstly_dispatchTimeupdate() { var burstly_evt = document.createEvent(\'Event\'); burstly_evt.initEvent(\'timeupdate\', true, true); return document.getElementById(burstly_videoElement).dispatchEvent(burstly_evt); }"

    invoke-virtual {p1, v0}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 293
    const-string v0, "javascript:function burstly_dispatchEnded() { var burstly_evt = document.createEvent(\'Event\'); burstly_evt.initEvent(\'ended\', true, true); return document.getElementById(burstly_videoElement).dispatchEvent(burstly_evt); }"

    invoke-virtual {p1, v0}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 296
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView$1;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;

    invoke-virtual {v0, v2, v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->updateDataObject(II)V

    .line 299
    const-string v0, "javascript:function burstly_videoDuration() { return burstly_videoDummy.duration; }"

    invoke-virtual {p1, v0}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 300
    const-string v0, "javascript:function burstly_videoCurrentTime() { return burstly_videoDummy.currentTime; }"

    invoke-virtual {p1, v0}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 301
    const-string v0, "javascript:function findVideoSrc() {var burstly_videoElementObject = document.getElementById(burstly_videoElement);if (burstly_videoElementObject) {var content = burstly_videoElementObject.innerHTML,srcs = content.match(/src=(.+\")/);if (srcs == null || srcs.length < 2) {return burstly_videoElementObject.src;}return srcs[1]; }}"

    invoke-virtual {p1, v0}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 304
    const-string v0, "javascript:var burstly = window.burstly || { rewards: {getVersion : function() { return \'0.1\'; }} }; if (!burstly.rewards){ burstly.rewards = {getVersion : function() { return \'0.1\'; }}};window.burstly = burstly;"

    invoke-virtual {p1, v0}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 306
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView$1;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;

    const/4 v1, 0x1

    iput-boolean v1, v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->mPageLoaded:Z

    .line 307
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView$1;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;

    invoke-virtual {v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->publishBridgeLoaded()V

    .line 308
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView$1;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;

    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView$1;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;

    invoke-virtual {v1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->isShown()Z

    move-result v1

    invoke-static {v1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->getState(Z)Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsBridgeState;

    move-result-object v1

    invoke-virtual {v0, v1, v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->fireBridgeStateEvent(Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsBridgeState;Z)V

    .line 309
    return-void
.end method

.method public onPageStarted(Landroid/webkit/WebView;Ljava/lang/String;Landroid/graphics/Bitmap;)V
    .locals 2
    .parameter "view"
    .parameter "url"
    .parameter "favicon"

    .prologue
    const/4 v1, 0x0

    .line 251
    invoke-super {p0, p1, p2, p3}, Lcom/burstly/lib/component/networkcomponent/burstly/wrapper/WebViewClientWrapper;->onPageStarted(Landroid/webkit/WebView;Ljava/lang/String;Landroid/graphics/Bitmap;)V

    .line 252
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView$1;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;

    iput-boolean v1, v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->mPageLoaded:Z

    .line 253
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView$1;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;

    iput-boolean v1, v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->mPublishedBridgeLoaded:Z

    .line 254
    return-void
.end method

.method public shouldOverrideUrlLoading(Landroid/webkit/WebView;Ljava/lang/String;)Z
    .locals 10
    .parameter "view"
    .parameter "url"

    .prologue
    const/4 v9, 0x0

    const/4 v8, 0x1

    .line 258
    invoke-super {p0, p1, p2}, Lcom/burstly/lib/component/networkcomponent/burstly/wrapper/WebViewClientWrapper;->shouldOverrideUrlLoading(Landroid/webkit/WebView;Ljava/lang/String;)Z

    move-result v3

    if-nez v3, :cond_0

    .line 259
    invoke-virtual {p2}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v2

    .line 260
    .local v2, lowerCase:Ljava/lang/String;
    const-string v3, "http"

    invoke-virtual {v2, v3}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v3

    if-eqz v3, :cond_1

    .line 261
    sget-object v3, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v4, "RewardsView"

    const-string v5, "Url to open in current window {0}"

    new-array v6, v8, [Ljava/lang/Object;

    aput-object p2, v6, v9

    invoke-virtual {v3, v4, v5, v6}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 262
    invoke-virtual {p1, p2}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 274
    .end local v2           #lowerCase:Ljava/lang/String;
    :cond_0
    :goto_0
    return v8

    .line 266
    .restart local v2       #lowerCase:Ljava/lang/String;
    :cond_1
    :try_start_0
    sget-object v3, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v4, "RewardsView"

    const-string v5, "Url to open in new window {0}"

    const/4 v6, 0x1

    new-array v6, v6, [Ljava/lang/Object;

    const/4 v7, 0x0

    aput-object p2, v6, v7

    invoke-virtual {v3, v4, v5, v6}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 267
    new-instance v1, Landroid/content/Intent;

    const-string v3, "android.intent.action.VIEW"

    invoke-static {p2}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v4

    invoke-direct {v1, v3, v4}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V

    .line 268
    .local v1, intent:Landroid/content/Intent;
    iget-object v3, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView$1;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;

    invoke-virtual {v3}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->getContext()Landroid/content/Context;

    move-result-object v3

    invoke-virtual {v3, v1}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V
    :try_end_0
    .catch Landroid/content/ActivityNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 270
    .end local v1           #intent:Landroid/content/Intent;
    :catch_0
    move-exception v0

    .line 271
    .local v0, anfe:Landroid/content/ActivityNotFoundException;
    sget-object v3, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v4, "RewardsView"

    invoke-virtual {v0}, Landroid/content/ActivityNotFoundException;->getMessage()Ljava/lang/String;

    move-result-object v5

    new-array v6, v9, [Ljava/lang/Object;

    invoke-virtual {v3, v4, v5, v6}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_0
.end method
